package com.sisyphus.simple.activities;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.sisyphus.spinach.ui.configs.IActivityConfigProvider;
import com.sisyphus.simple.R;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

/**
 * 用户注册
 */
public class RegisterActivity extends AppCompatActivity implements IActivityConfigProvider {

    @Override
    public int getLayoutResID() {
        return R.layout.activity_register;
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Button button = findViewById(R.id.button_register);

        button.setOnClickListener(this::register);
    }

    private void register(View button) {
        EditText editEmail = findViewById(R.id.edit_email);
        EditText editNickname = findViewById(R.id.edit_nickname);
        EditText editPassword = findViewById(R.id.edit_password);

//        new FormTask.Builder<>()
//                .form(new Form.NotEmpty(Arrays.asList(editEmail, editNickname), "不能为空"))
//                .view(new ToastView<>(this))
//                .netTask(
//                        new NetSingleTask<>(
//                                getLifecycle(),
//                                DataRepository.getInstance()
//                                        .register(
//                                                editEmail.getText().toString(),
//                                                editPassword.getText().toString(),
//                                                editNickname.getText().toString()
//                                        )
//                        )
//                )
//                .view(new Debounce<>(button, new ToastView<>(RegisterActivity.this)))
//                .build()
//                .execute();
    }

}
